﻿using System;

namespace SerialPortLibrary
{
    public interface IDataPublish
    {
        event DataPublishEventHandler DataPublishEvent;
    }

    public abstract class DataPublish : IDataPublish
    {
        protected ISerialData serialdata;

        public event DataPublishEventHandler DataPublishEvent;
        protected bool OnDataPublishEvent(DataPublishEventArgs e)
        {
            if (DataPublishEvent != null)
            {
                return DataPublishEvent(this, e);
            }
            return false;
        }
    }
    public delegate bool DataPublishEventHandler(object sender, DataPublishEventArgs e);
    public class DataPublishEventArgs : System.EventArgs
    {
        public ISerialData data;

        public DataPublishEventArgs(ISerialData data)
        {
            this.data = data;
        }
    }
}
